package com.yonyou.iuap.controller.app;

import java.util.HashMap;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yonyou.iuap.pub.JsonUtils;
import com.yonyou.iuap.shell.pub.ResultDto;
import com.yonyou.iuap.shell.service.intf.IIndustryChartService;

/**
 * 根据设备查询部件
 * **/
@Controller
@RequestMapping("/industrychar")
public class IndustrychartEntityController {
	private final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
	private long start,end;
	@Autowired
	private IIndustryChartService industryChartServiceImpl;
	
	@RequestMapping(value="App/selectindustrychar",method=RequestMethod.POST)
	@ResponseBody
	public String selectindustrychar(HttpServletRequest resq,@RequestBody HashMap parMap){
		start=System.currentTimeMillis();
		ResultDto resDto = new ResultDto();
		String pk_industry_chart=parMap.get("pk_industry_chart").toString();
		if(StringUtils.isEmpty(pk_industry_chart)){
			resDto.setStatus(1);
			resDto.setMessage("参数为空!");
		}else{
			StringBuffer str=new StringBuffer();
			str.append("fw_parent='"+pk_industry_chart+"'");
			resDto=industryChartServiceImpl.selectByCondition(str.toString());
		}
		String rtn_json = JsonUtils.toJsonStr(resDto);
		end=System.currentTimeMillis();
		logger.info("selectindustrychar接口调用时间"+String.valueOf(end-start));
		return rtn_json;
	}

}
